﻿@namespace AntDesign
@inherits AntDomComponentBase

<div @ref="@_element" id="@Id">
    <div class=@($"{Config.PrefixCls}-root")>
        @if (Config.Mask)
        {
            <div class=@($"{Config.PrefixCls}-mask {GetMaskClsName()}") style="@Config.MaskStyle"></div>
        }
        <div tabindex="-1" class=@($"{Config.PrefixCls}-wrap {Config.GetWrapClassNameExtended(this.Status)}") role="dialog"
             @onclick="@EventUtil.AsNonRenderingEventHandler(OnMaskClick)"
             @onmouseup="@EventUtil.AsNonRenderingEventHandler(OnMaskMouseUp)"
             @onkeydown="@(EventUtil.AsNonRenderingEventHandler<KeyboardEventArgs>(OnKeyDown))"
             style="@_wrapStyle">
            <div @ref="@_modal" role="document" 
                 class=@($"{Config.PrefixCls} {GetModalClsName()}")
                 @onclick:stopPropagation
                 @onmousedown="@EventUtil.AsNonRenderingEventHandler(OnDialogMouseDown)"
                 style="@GetStyle()"
                 >
                <div id="@_sentinelStart" tabindex="0" aria-hidden="true" style="width: 0px; height: 0px; overflow: hidden; outline: none;"></div>
                <div class=@($"{Config.PrefixCls}-content") style="@(_resizing ? "resize:both; overflow: hidden;":"")" id=@($"{Config.PrefixCls}-wrap_{DialogWrapperId}")>
                    @if (Config.Header != null)
                    {
                        <CascadingValue Value="@Config">
                            <CascadingValue Name="Parent" Value="@this">
                                <div @ref="@_dialogHeader" class=@($"{Config.PrefixCls}-header") style="@Config.GetHeaderStyle()">
                                    @Config.Header
                                </div>
                            </CascadingValue>
                        </CascadingValue>
                    }
                    <div class=@($"{Config.PrefixCls}-body") style="@GetBodyStyle()">
                        @ChildContent
                    </div>
                    @if (Config.Footer != null)
                    {
                        <div class=@($"{Config.PrefixCls}-footer")>
                            <CascadingValue Value="@Config">
                                @if (Config.Footer.Value.IsT0)
                                {
                                    @(Config.Footer.Value.AsT0)
                                }
                                else
                                {
                                    @(Config.Footer.Value.AsT1)
                                }
                            </CascadingValue>
                        </div>
                    }
                </div>
                <div id="@_sentinelEnd" tabindex="0" aria-hidden="true" style="width: 0px; height: 0px; overflow: hidden; outline: none;"></div>
            </div>
        </div>
    </div>
    @if (AdditionalContent != null)
    {
        @AdditionalContent
    }
</div>
